package com.bwie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.mapper.EventsMapper;
import com.bwie.pojo.Events;
import com.bwie.service.EventsService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EventsServiceImpl extends ServiceImpl<EventsMapper, Events> implements EventsService {

    @Autowired
    EventsMapper eventsMapper;

    @Override
    public R eventsList(PageInfoVo pageInfoVo) {
        // 构造分页条件
        Page<Events> page = new Page<>(pageInfoVo.getPageNum(), pageInfoVo.getPageSize());
        // 查询列表数据
        QueryWrapper<Events> wrapper = new QueryWrapper<>();
        // 列表数据
        Page<Events> productPage = eventsMapper.selectPage(page, wrapper);
        // 返回
        return R.OK(productPage);
    }
}
